+Fri Jan 11 17:53:58 2002 Owen Taylor <otaylor@redhat.com>
+
+ * pixops/pixops.c (pixops_scale_nearest): Remove meaningless
+ FIXME.
+
+ * pixops/pixops.c (pixops_process): Comment the computation
+ of run_end_index and fix some edge cases.
+
+ * pixops/{scale_line_22_33_mmx.S, composite_line_22_4a4_mmx.S:
+ composite_line_color_22_4a4_mmx.S}: Handle the case where
+ dest <= dest_end properly. (#52001)
+
Thu Jan 10 16:48:30 2002 Owen Taylor <otaylor@redhat.com>
* pixops/pixops.c: Replace some hardcoded values with the
- SUBSAMPLE
+ SUBSAMPLE constant used elsewhere. (#51033)
Wed Jan 9 11:29:44 2002 Owen Taylor <otaylor@redhat.com>
for (i = 0; i < (render_y1 - render_y0); i++)
{
const guchar *src = src_buf + (((i + render_y0) * y_step + y_step / 2) >> SCALE_SHIFT) * src_rowstride;
- /* FIXME Owen needs to look at this */
guchar *dest = dest_buf + i * dest_rowstride;
x = render_x0 * x_step + x_step / 2;
PixopsPixelFunc pixel_func)
{
int i, j;
- int x, y;
+ int x, y; /* X and Y position in source (fixed_point) */
guchar **line_bufs = g_new (guchar *, filter->n_y);
- int x_step = (1 << SCALE_SHIFT) / scale_x;
- int y_step = (1 << SCALE_SHIFT) / scale_y;
+ int x_step = (1 << SCALE_SHIFT) / scale_x; /* X step in source (fixed point) */
+ int y_step = (1 << SCALE_SHIFT) / scale_y; /* Y step in source (fixed point) */
+
+ int check_shift = check_size ? get_check_shift (check_size) : 0;
- int dest_x;
int scaled_x_offset = floor (filter->x_offset * (1 << SCALE_SHIFT));
- int run_end_index = (((src_width - filter->n_x + 1) << SCALE_SHIFT) - scaled_x_offset - 1) / x_step + 1 - render_x0;
- int check_shift = check_size ? get_check_shift (check_size) : 0;
+ /* Compute the index where we run off the end of the source buffer. The furthest
+ * source pixel we access at index i is:
+ *
+ * ((render_x0 + i) * x_step + scaled_x_offset) >> SCALE_SHIFT + filter->n_x - 1
+ *
+ * So, run_end_index is the smallest i for which this pixel is src_width, i.e, for which:
+ *
+ * (i + render_x0) * x_step >= ((src_width - filter->n_x + 1) << SCALE_SHIFT) - scaled_x_offset
+ *
+ */
+#define MYDIV(a,b) ((a) > 0 ? (a) / (b) : ((a) - (b) + 1) / (b)) /* Division so that -1/5 = -1 */
+
+ int run_end_x = (((src_width - filter->n_x + 1) << SCALE_SHIFT) - scaled_x_offset);
+ int run_end_index = MYDIV (run_end_x + x_step - 1, x_step) - render_x0;
+ run_end_index = MIN (run_end_index, render_x1 - render_x0);
y = render_y0 * y_step + floor (filter->y_offset * (1 << SCALE_SHIFT));
for (i = 0; i < (render_y1 - render_y0); i++)
{
+ int dest_x;
int y_start = y >> SCALE_SHIFT;
int x_start;
int *run_weights = filter->weights + ((y >> (SCALE_SHIFT - SUBSAMPLE_BITS)) & SUBSAMPLE_MASK) * filter->n_x * filter->n_y * SUBSAMPLE;
outbuf += dest_channels;
}
- new_outbuf = (*line_func)(run_weights, filter->n_x, filter->n_y,
- outbuf, dest_x,
- MIN (outbuf_end, dest_buf + dest_rowstride * i + run_end_index * dest_channels),
- dest_channels, dest_has_alpha,
- line_bufs, src_channels, src_has_alpha,
- x, x_step, src_width, check_size, tcolor1, tcolor2);
+ new_outbuf = (*line_func) (run_weights, filter->n_x, filter->n_y,
+ outbuf, dest_x,
+ dest_buf + dest_rowstride * i + run_end_index * dest_channels,
+ dest_channels, dest_has_alpha,
+ line_bufs, src_channels, src_has_alpha,
+ x, x_step, src_width, check_size, tcolor1, tcolor2);
dest_x += (new_outbuf - outbuf) / dest_channels;
}
else /* Tile */
{
+ /* x
+ * ---------|--.-|----|--.-|------- SRC
+ * ------------|---------|--------- DEST
+ */
for (i = 0; i < n_x; i++)
{
if (i < x)
}
else /* Tile */
{
+ /* y
+ * ---------|--.-|----|--.-|------- SRC
+ * ------------|---------|--------- DEST
+ */
for (i = 0; i < n_y; i++)
{
if (i < y)